package com.itheima.homework;

public class Test11 {
    /*
        【编号：606】 设计一个方法，用于比较两个相同数据类型数组的内容是否相同。
    */
    public static void main(String[] args) {
        int[] arr01 = {11,22,33,44,33};
        int[] arr02 = {11,22,33,44,33};
        int[] arr03 = {11,22,55,33,44};
        int[] arr04 = {11,22,33};
        boolean res01 = compare(arr01,arr02);
        System.out.println(res01);
        boolean res02 = compare(arr01,arr03);
        System.out.println(res02);
        boolean res03 = compare(arr01,arr04);
        System.out.println(res03);

    }
    public static boolean compare(int[] arr01,int[] arr02){
        //如果数组长度不相等直接返回false
        if(arr01.length != arr02.length){
            return false;
        }
        //遍历数组只要有不同的就返回false
        for(int i = 0;i < arr02.length;i++){
            if(arr01[i] != arr02[i]){
                return false;
            }
        }
        return true;
    }
}
